void make2D(float max,char* option,char* name) {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("jobruntime-effi","jobruntime-effi");
TH2F* cms=new TH2F("cms","cms",100,0,1,100,0,max);
TH2F* atlas=new TH2F("atlas","atlas",100,0,1,100,0,max);
TH2F* lhcb=new TH2F("lhcb","lhcb",100,0,1,100,0,max);
TH2F* alice=new TH2F("alice","alice",100,0,1,100,0,max);
cms->SetXTitle("efficiency ");
atlas->SetXTitle("efficiency ");
lhcb->SetXTitle("efficiency ");
alice->SetXTitle("efficiency ");
cms->SetYTitle("job run time (h) ");
atlas->SetYTitle("job run time (h) ");
lhcb->SetYTitle("job run time (h) ");
alice->SetYTitle("job run time (h) ");
cms->SetFillColor(1);
atlas->SetFillColor(2);  
lhcb->SetFillColor(3);
alice->SetFillColor(4);
tv->Divide(2,2);
tv->cd(4);
tree->Draw("(logmonitor_wn_Time/3600):efficiency >> cms","VO.fData==\"cms\"",option);
tv->cd(2);
tree->Draw("(logmonitor_wn_Time/3600):efficiency >> atlas","VO.fData==\"atlas\"",option);
tv->cd(3);
tree->Draw("(logmonitor_wn_Time/3600):efficiency >> lhcb","VO.fData==\"lhcb\"",option);
tv->cd(1);
tree->Draw("(logmonitor_wn_Time/3600):efficiency >> alice","VO.fData==\"alice\"",option);
tv->Print(name);
}

makeJobCE(char* voname="cms",int color,char* filename="ce.pdf") {
//TCanvas* cv=new TCanvas("t","t");
gStyle->SetOptStat(0);
tree->Draw("CE.fData>>ce",Form("VO.fData==\"%s\"",voname));
ce->SetFillColor(color);
ce->SetTitle(Form("CE distribution for vo %s",voname));
ce->GetXaxis()->SetLabelSize(0.020);
ce->LabelsOption("a","X");
ce->LabelsOption(">v","X");

//cv->Print(filename);
}

void JobRB() {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("job-rb","job-rb");
TH1F* cms=NULL;
TH1F* atlas=NULL;
TH1F* lhcb=NULL;
TH1F* alice=NULL;
cms=(TH1F*)gROOT->FindObject("cms");
atlas=(TH1F*)gROOT->FindObject("alice");
alice=(TH1F*)gROOT->FindObject("atlas");
lhcb=(TH1F*)gROOT->FindObject("lhcb");
tv->Divide(2,2);
tv->cd(1);
tree->Draw("RB.fData >> alice","VO.fData==\"alice\"");
gDirectory->GetObject("alice",alice);
alice->SetTitle("ALICE");
alice->SetXTitle("RB");
alice->SetYTitle("Njobs");
alice->SetFillColor(1);
alice->LabelsOption("a","X");
alice->LabelsOption(">v","X");
alice->Draw();
tv->cd(2);
tree->Draw("RB.fData >> atlas","VO.fData==\"atlas\"");
gDirectory->GetObject("atlas",atlas);
atlas->SetTitle("ATLAS");   
atlas->SetXTitle("RB");
atlas->SetYTitle("Njobs");
atlas->SetFillColor(2);   
atlas->LabelsOption("a","X");
atlas->LabelsOption(">v","X");
atlas->Draw();
tv->cd(3);
tree->Draw("RB.fData >> lhcb","VO.fData==\"lhcb\"");
gDirectory->GetObject("lhcb",lhcb);
lhcb->SetTitle("LHCB");   
lhcb->SetXTitle("RB");
lhcb->SetYTitle("Njobs");
lhcb->SetFillColor(3);   
lhcb->LabelsOption("a","X");
lhcb->LabelsOption(">v","X");
lhcb->Draw();
tv->cd(4);
tree->Draw("RB.fData >> cms","VO.fData==\"cms\"");
gDirectory->GetObject("cms",cms);
cms->SetTitle("CMS");   
cms->SetXTitle("RB");
cms->SetYTitle("Njobs");
cms->SetFillColor(4);   
cms->LabelsOption("a","X");
cms->LabelsOption(">v","X");
cms->Draw();
}

void WN()
{
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("wn-ce","wn-ce");
tree->Draw("WN.fData:CE.fData >> ab",GridPP);
TH2F* div=ab;
ab->Divide(div);
TH1D* d1=ab->ProjectionX();
d1->Draw()
}

void JobRunTime(float max) {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(110010);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("JobRunTime","JobRunTime");
TH1F* cms=new TH1F("cms","cms",100,0,max);
TH1F* atlas=new TH1F("atlas","atlas",100,0,max);
TH1F* lhcb=new TH1F("lhcb","lhcb",100,0,max);
TH1F* alice=new TH1F("alice","alice",100,0,max);
cms->SetYTitle("NJobs");
atlas->SetYTitle("NJobs");
lhcb->SetYTitle("NJobs");
alice->SetYTitle("NJobs");
cms->SetXTitle("Job Run Time (h) ");
atlas->SetXTitle("Job Run Time (h) ");
lhcb->SetXTitle("Job Run Time (h) ");
alice->SetXTitle("Job Run Time (h) ");
cms->SetFillColor(1);
atlas->SetFillColor(2);
lhcb->SetFillColor(3);
alice->SetFillColor(4);
tv->Divide(2,2);
tv->cd(4);
tree->Draw("(logmonitor_wn_Time/3600) >> cms","VO.fData==\"cms\"");
tv->cd(2);
tree->Draw("(logmonitor_wn_Time/3600) >> atlas","VO.fData==\"atlas\"");
tv->cd(3);
tree->Draw("(logmonitor_wn_Time/3600) >> lhcb","VO.fData==\"lhcb\"");
tv->cd(1);
tree->Draw("(logmonitor_wn_Time/3600) >> alice","VO.fData==\"alice\"");
tv->Print("JobRunTime.pdf");
}
void JobRunTimeWT(float max) {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(110010);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("JobRunTime","JobRunTime");
TH1F* cms=new TH1F("cms","cms",100,0,max);
TH1F* atlas=new TH1F("atlas","atlas",100,0,max);
TH1F* lhcb=new TH1F("lhcb","lhcb",100,0,max);
TH1F* alice=new TH1F("alice","alice",100,0,max);
cms->SetYTitle("Hours");
atlas->SetYTitle("Hours");
lhcb->SetYTitle("Hours");
alice->SetYTitle("Hours");
cms->SetXTitle("Job Run Time (h) ");
atlas->SetXTitle("Job Run Time (h) ");
lhcb->SetXTitle("Job Run Time (h) ");
alice->SetXTitle("Job Run Time (h) ");
cms->SetFillColor(1);
atlas->SetFillColor(2);
lhcb->SetFillColor(3);
alice->SetFillColor(4);
tv->Divide(2,2);
tv->cd(4);
tree->Draw("(logmonitor_wn_Time/3600) >> cms","(logmonitor_wn_Time/3600)*(VO.fData==\"cms\")");
tv->cd(2);
tree->Draw("(logmonitor_wn_Time/3600) >> atlas","(logmonitor_wn_Time/3600)*(VO.fData==\"atlas\")");
tv->cd(3);
tree->Draw("(logmonitor_wn_Time/3600) >> lhcb","(logmonitor_wn_Time/3600)*(VO.fData==\"lhcb\")");
tv->cd(1);
tree->Draw("(logmonitor_wn_Time/3600) >> alice","(logmonitor_wn_Time/3600)*(VO.fData==\"alice\")");
tv->Print("JobRunTimeWT.pdf");
}


void JobEfficiency(float max) {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("JobEfficiency","JobEfficiency");
TH1F* cms=new TH1F("cms","cms",100,0,max);
TH1F* atlas=new TH1F("atlas","atlas",100,0,max);
TH1F* lhcb=new TH1F("lhcb","lhcb",100,0,max);
TH1F* alice=new TH1F("alice","alice",100,0,max);
cms->SetYTitle("NJobs ");
atlas->SetYTitle("NJobs ");
lhcb->SetYTitle("NJobs ");
alice->SetYTitle("NJobs ");
cms->SetXTitle("Efficiency");
atlas->SetXTitle("Efficiency");
lhcb->SetXTitle("Efficiency");
alice->SetXTitle("Efficiency");
cms->SetFillColor(1);
atlas->SetFillColor(2);
lhcb->SetFillColor(3);
alice->SetFillColor(4);
tv->Divide(2,2);
tv->cd(4);
tree->Draw("efficiency >> cms","VO.fData==\"cms\"");
tv->cd(2);
tree->Draw("efficiency >> atlas","VO.fData==\"atlas\"");
tv->cd(3);
tree->Draw("efficiency >> lhcb","VO.fData==\"lhcb\"");
tv->cd(1);
tree->Draw("efficiency >> alice","VO.fData==\"alice\"");
tv->Print("JobEfficiency.pdf");
}

void JobEfficiencyWT(float max) {
gROOT->SetStyle("Plain");
gStyle->SetOptStat(0);
//gStyle->SetFillColor(0);
TCanvas* tv=new TCanvas("JobEfficiency","JobEfficiency");
TH1F* cms=new TH1F("cms","cms",100,0,max);
TH1F* atlas=new TH1F("atlas","atlas",100,0,max);
TH1F* lhcb=new TH1F("lhcb","lhcb",100,0,max);
TH1F* alice=new TH1F("alice","alice",100,0,max);
cms->SetYTitle("NJobs ");
atlas->SetYTitle("NJobs ");
lhcb->SetYTitle("NJobs ");
alice->SetYTitle("NJobs ");
cms->SetXTitle("Efficiency");
atlas->SetXTitle("Efficiency");
lhcb->SetXTitle("Efficiency");
alice->SetXTitle("Efficiency");
cms->SetFillColor(1);
atlas->SetFillColor(2);
lhcb->SetFillColor(3);
alice->SetFillColor(4);
tv->Divide(2,2);
tv->cd(4);
tree->Draw("efficiency >> cms","(logmonitor_wn_Time/3600)*(VO.fData==\"cms\")");
tv->cd(2);
tree->Draw("efficiency >> atlas","(logmonitor_wn_Time/3600)*(VO.fData==\"atlas\")");
tv->cd(3);
tree->Draw("efficiency >> lhcb","(logmonitor_wn_Time/3600)*(VO.fData==\"lhcb\")");
tv->cd(1);
tree->Draw("efficiency >> alice","(logmonitor_wn_Time/3600)*(VO.fData==\"alice\")");
tv->Print("JobEfficiency.pdf");
}
